package com.trek.utils;

import java.io.IOException;
import java.util.Properties;

import org.springframework.core.io.ClassPathResource;

/**
 * 特定的配置文件的读取
 * 
 * @author trekxu
 *
 */
public class PropertiesUtils {

	private static final String FILE_NAME = "codeconfig.properties";

	private static Properties properties;
	
	static {
		properties = new Properties();
		try {
			properties.load(new ClassPathResource(FILE_NAME).getInputStream());
		} catch (IOException e) {
			System.err.print("codeconfig.properties文件不存在");
			e.printStackTrace();
		}
	}
	
	/**
	 * 通过键获取值
	 * @param key
	 * @return
	 */
	public static String getValue(String key) {
		return properties.getProperty(key);
	}
	
}
